﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

using QuDao;
using FineUICore;
using Kalman;
using Kalman.Extensions;
using Microsoft.AspNetCore.Http;
using AliyunOss;

namespace AdminUI.Pages.BaseData
{
    public partial class TenantAccountAddModel : BaseModel
    {
        readonly AliyunOssClient oss;
        public TenantAccountAddModel(AliyunOssClient ossClient)
        {
            oss = ossClient;
        }

        public void OnGet(int tid)
        {
            TenantID = tid;
        }

        public int TenantID { get; set; }

        public IActionResult OnPostBtnSubmit_Click(TenantAccountAddDto dto)
        {
            try
            {
                var id = TenantAccountBO.Instance.Add(dto);
                LogAction(ActionType.新增, $"新增银行账户：{dto.TID}-{dto.BankName}");

                FineUICore.PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
                //ActiveWindow.HidePostBack();
            }
            catch (Exception ex)
            {
                var msg = ex.Message;
                if (!(ex is AppException && ex.InnerException == null))
                {
                    msg = ex.ToString();
                }

                Alert.Show(msg, "错误信息", MessageBoxIcon.Error);
            }

            return UIHelper.Result();
        }

    }
}